'use strict';

const axios = require('axios');

const BASE_URL = process.env.LUO_CLI_BASE_URL ? process.env.LUO_CLI_BASE_URL :
  // 'http://book.youbaobao.xyz:7001';
  // 本地使用switchhost修改localhost需要关闭代理才生效
  // 'http://luo-cli-server:7001'
  'https://luo-cli-server.netlify.app'

const request = axios.create({
  baseURL: BASE_URL,
  timeout: 10000,
});

request.interceptors.response.use(
  response => {
    return response.data;
  },
  error => {
    return Promise.reject(error);
  }
);

module.exports = request;
